import { defineComponent } from 'vue'

export default defineComponent({
  name: 'SvgIcon',
  props: {
    name: {
      type: String,
      required: true
    },
  },
  setup (props, { attrs }) {
    /* render 函数 */
    return () => {
      const { name } = props
      return (
        <svg class="svg-icon" { ...attrs }>
          <use href={ `#${name}` } />
        </svg>
      )
    }
  }
})
